package helpers;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class IpHelper {
	public static boolean checkIsIp(String ip) {
		boolean isIp = false;
		Pattern p = Pattern.compile("^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$");
		Matcher m = p.matcher(ip);
		if (m.find()) {
			isIp = true;
		}
		return isIp;
	}
	
	public static void main(String[] args) {
		String ip = "1.55.2.137";
		System.out.println(checkIsIp(ip));
	}
}
